<template>
  <div>
    <el-card class="box-card" shadow="never">
      <div slot="header" class="clearfix">
        <span> 🍻 推广 </span>
      </div>
      <div v-for="item in list" :key="item.id">
        <a :href="item.link" target="_black">{{ item.title }}</a>
      </div>
    </el-card>
  </div>
</template>

<script>
import { getAllPromotions } from '../../api/promotion'
export default {
    name:"Promotion",
    data() {
      return {
        list:[],
      }
    },
    created(){
      this.fectchPromotion();
    },
    methods: {
      fectchPromotion(){
        getAllPromotions().then(res=>{
          const result = res.data;
          if(result.code == 0){
            this.list = result.data;
          }else{
            this.$message({
              message: "获取推荐失败",
              type: "error",
            })
          }
        })
      }
    },
};
</script>

<style>
</style>